@extends('layouts.admin')
@section('style')
@endsection
@section('content')
    <div class="layui-container openframe">
        <form method="post" action="{{ url('password') }}" id="password_form"
              class="layui-form layui-form-pane" novalidate="1">
            <input type="hidden" name="id" value="{{ $id }}"/>
            {{ csrf_field() }}
            <div class="layui-form-item">
                <label class="layui-form-label"><span>*</span>登录手机号</label>
                <div class="layui-input-block">
                    <input type="text" readonly value="{{ $vo->mobile }}" id="mobile"
                           class="layui-input layui-disabled">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span>*</span>操作员姓名</label>
                <div class="layui-input-block">
                    <input type="text" readonly value="{{ $vo->nickname }}" id="nickname"
                           class="layui-input layui-disabled">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span>*</span>密码</label>
                <div class="layui-input-block">
                    <input type="password" name="password" lay-verify="password" value="" id="password"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span>*</span>确认密码</label>
                <div class="layui-input-block">
                    <input type="password" name="repassword" data-password="password" lay-verify="repassword" value=""
                           id="repassword" class="layui-input">
                </div>
            </div>
            <input type="hidden" lay-submit lay-filter="save"/>
        </form>
    </div>
@endsection
@section('script')
    <script type="text/javascript">
        var doSubmit = null;
        layui.use(['form', 'element', 'jquery', 'layer'], function () {
            var layer = layui.layer,
                $ = layui.$,
                element = layui.element,
                form = layui.form;

            doSubmit = function (index,callback) {
                var form = $("#password_form");
                $.ajax({
                    url: form.prop('action'),
                    type: 'post',
                    dataType: 'json',
                    data: form.serialize(),
                    success: function (res) {
                        if (res.code == 1) {
                            layer.msg(res.message, {icon: 6, times: 2000}, function () {
                                callback(res.data.redirect);
                            })
                        } else {
                            layer.msg(res.message, {icon: 5, times: 2000})
                        }
                    }
                })
            }
        })
    </script>
@endsection